<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		#box1{
			width: 200px;
			height: 200px;
			background: red url() 0 0 no-repeat;
		}
		#box2{
			width: 200px;
			height: 200px;
			background: blue url() 0 0 no-repeat;
		}

		.son{
			width: 100px;
			height:100px;
			background: yellow url() 0 0 no-repeat;
		}

	</style>
	<script>
		
		window.onload= function () {
			box1 = document.getElementById("box1")
			box2 = document.getElementById("box2")

			box2.onclick = function () {

				if(box1.innerHTML!=''){
					box2.innerHTML = box1.innerHTML;
					box1.innerHTML = "";
				}
			}

			box1.onclick = function () {
				if(box2.innerHTML!=''){
					box1.innerHTML = box2.innerHTML;
					box2.innerHTML = "";
				}
			}
		}
	</script>
</head>
<body>
	<div id="box1">
		<div class="son">我是小盒子</div>
	</div>
	<div id="box2"></div>
</body>
</html>